Repository navigation
test(ui): add Roborazzi screenshot baselines for the three themes - #271
Merged
Merged
Conversation
Phase 5 of docs/TEST_COVERAGE_PRD.md, final item. Android only —
iOS snapshots are deliberately out of scope (see below).
Runs on Robolectric with native graphics, so this is a plain JVM test
inside the existing jvm-tests.yml gate: no emulator, no new CI job. It
attaches to the Compose test infrastructure core:ui already has.
## What it covers that nothing else can
The rest of Phase 5 asserts what the semantics tree can answer:
contrast ratios (ColorSchemeContrastTest) and accessible names
(PlayerAccessibilityTest, ReaderTopBarAccessibilityTest). All of it is
blind to pixels — text clipped by a small container, overlapping
controls, a divider vanishing into its background, a theme that
silently stops applying.
Deliberately a SMALL set: one sampler composable in Dark, Light and
Sepia. Baselines are a liability as well as an asset — every
intentional UI change rewrites them, and a large set trains everyone
to re-record without looking. Three images that get inspected beat
thirty that get rubber-stamped. All three were viewed before
committing.
## The gate was vacuous by default — found and fixed
`captureRoboImage()` is a NO-OP in a normal test run: with neither
record nor verify set it neither writes nor compares. So
`./gradlew testDebugUnitTest` — precisely what jvm-tests.yml runs —
PASSED with a deliberately mutated theme colour. Shipping that would
have added three baseline images and a CI gate that could never fail.
Fixed with roborazzi.test.verify=true in gradle.properties, which
makes comparison the default locally and in CI. Confirmed empirically,
all three directions:
- unchanged code -> testDebugUnitTest passes
- SepiaBackground F5EDD6 -> F5E0B0 -> testDebugUnitTest FAILS,
and only the sepia case, not dark/light
- recordRoborazziDebug -> still records, so the
override for intentional updates still works
## Baselines are gated behind a human
`**/src/test/screenshots/**` added to agent-policy.yml sensitive_paths,
alongside testdata/vault-format for identical reasons: re-recording a
baseline makes a failing test pass WHILE RECORDING THE BREAK. The fix
for a red screenshot test is almost always the UI, not the baseline,
but recordRoborazziDebug is the easier keystroke — and this repo
auto-merges agent PRs.
## iOS
Not included. Without local macOS, iOS baselines could only be
recorded and visually approved through CI artifacts, and blessing an
image you cannot readily look at is worse than having no baseline.
Filed separately.
Contributor
📱 iOS Build Status: PASSED✅ iOS Simulator Build & Unit Tests - success iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
This was referenced Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Final item of Phase 5 of
docs/TEST_COVERAGE_PRD.md. Follows #266, #268, #269. Android only — iOS snapshots deliberately out of scope, see below.Runs on Robolectric with native graphics, so this is a plain JVM test inside the existing
jvm-tests.ymlgate: no emulator, no new CI job. It attaches to the Compose test infrastructurecore:uialready has.What it covers that nothing else can
The rest of Phase 5 asserts what the semantics tree can answer — contrast ratios (#266) and accessible names (#268, #269). All of that is blind to pixels: text clipped by a too-small container, overlapping controls, a divider vanishing into its background, a theme that silently stops applying.
Notably this is where the touch-target check from #268 actually belongs — that one was deleted because Compose's semantics report every target as 48dp regardless of drawn size. Visual overlap is a pixel question.
The gate was vacuous by default — found and fixed
This is the part worth reading.
captureRoboImage()is a no-op in a normal test run: with neither record nor verify set, it neither writes nor compares. So./gradlew testDebugUnitTest— precisely whatjvm-tests.ymlruns — passed with a deliberately mutated theme colour.Shipping that would have added three baseline images and a CI gate that could never fail. It looks exactly like working screenshot testing.
Fixed with
roborazzi.test.verify=trueingradle.properties, making comparison the default locally and in CI. Confirmed empirically in all three directions:testDebugUnitTestpassesSepiaBackgroundF5EDD6->F5E0B0testDebugUnitTestfails — and only the sepia case, not dark/lightrecordRoborazziDebugThis is the fifth vacuous test this session, and the first at the infrastructure level rather than in an individual assertion.
Baselines are gated behind a human
**/src/test/screenshots/**is added toagent-policy.ymlsensitive_paths, alongsidetestdata/vault-formatfor identical reasons:The fix for a red screenshot test is almost always the UI, not the baseline — but
recordRoborazziDebugis the easier keystroke, and this repo auto-merges agent PRs. So an agent that hits a diff can never bless it unattended.Deliberately small
One sampler composable in Dark, Light and Sepia. Baselines are a liability as well as an asset: every intentional UI change rewrites them, and a large set trains everyone to re-record without looking. Three images that get inspected beat thirty that get rubber-stamped.
All three were viewed before committing — that's the standard I argued for, so I held to it. The sampler includes secondary text on
surfaceVarianton purpose: the exact pairing that was below WCAG AA in sepia until #266.~117KB total.
iOS
Not included. Without local macOS, iOS baselines could only be recorded and visually approved through CI artifacts, and blessing an image you cannot readily look at is worse than having no baseline. Filing separately.
Refs
docs/TEST_COVERAGE_PRD.mdPhase 5